#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import base64
import random
import time
from io import BytesIO
import cv2
from PIL import Image
from selenium.webdriver import ActionChains

from common.readelement import Element
from page_object.webpage import WebPage
from tools.logger import Log

createFulltimeResume = Element('jzsz/personal/create_fulltime_resume')


class CreateFulltimeResumePage(WebPage):
    """添加全职简历类"""

    def username(self):
        """用户信息"""
        self.is_click(createFulltimeResume['用户信息'])
        self.is_click(createFulltimeResume['求职意向'])

    def is_true(self):
        """判断当前用户是否已有简历"""
        res = self.is_exists2(createFulltimeResume['删除简历'])
        if res:
            self.is_click(createFulltimeResume['删除简历'])
            self.is_click(createFulltimeResume['确定删除'])

    def add_resume(self):
        """添加简历"""
        self.is_click(createFulltimeResume['添加简历'])

    def add_resume_content(self,resumeName,expectedSalary1,expectedSalary2):
        """简历内容"""
        self.input_text(createFulltimeResume['简历名称'], resumeName)
        self.is_click(createFulltimeResume['工作年限下拉框'])
        self.is_click(createFulltimeResume['10年工作经验'])
        self.is_click(createFulltimeResume['文化程度'])
        self.is_click(createFulltimeResume['硕士及以上'])
        self.is_click(createFulltimeResume['意向岗位'])
        self.is_click(createFulltimeResume['一级目录'])
        self.is_click(createFulltimeResume['二级目录'])
        self.is_click(createFulltimeResume['三级目录'])
        self.is_click(createFulltimeResume['四级目录'])
        self.input_text(createFulltimeResume['期望薪资1'],expectedSalary1)
        self.input_text(createFulltimeResume['期望薪资2'], expectedSalary2)

    def release_resume(self):
        """发布简历"""
        self.focus()
        self.is_click(createFulltimeResume['发布'])
        self.is_click(createFulltimeResume['确定'])

    def release_success(self):
        """验证添加成功"""
        return self.is_exists(createFulltimeResume['查看简历'])






